﻿using System;
using System.IO;

namespace FaymanController.Utils
{
    /// <summary>
    /// 文件实用类
    /// </summary>
    public static class FileIO
    {
        /// <summary>
        /// 从一个指定文件名读取字节流
        /// </summary>
        /// <param name="FileName"></param>
        /// <returns></returns>
        public static string ReadFile(string FileName)
        {
            StreamReader sr = new StreamReader(FileName);
            var content = sr.ReadToEnd();
            sr.Close();
            return content;
        }
        /// <summary>
        /// 向一个制定文件名写入字节流
        /// </summary>
        /// <param name="FileName"></param>
        /// <param name="Content"></param>
        public static void WriteFile(string FileName, string Content)
        {
            StreamWriter sw = new StreamWriter(FileName);
            sw.Write(Content);
            sw.Close();
        }
    }
}
